<jsp:directive.page import="Connectivity.ConnectionManager"/>
<jsp:directive.page import="java.sql.*"/>
<jsp:directive.page import="java.io.File"/>
 <%
 	String path1 = "/container/images/";
    String basePath1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path1+"/";
 %>
<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Login </title>
<link rel="stylesheet" type="text/css" href="<%=basePath1%>login-box.css">
</head>

<script>
	function valid()
	{
		if(loginform.uname.value==(""))
		{
		 alert ("Enter the loginid");
		 document.loginForm.uname.focus();
		 return false;
	     response.sendRedirect("/Genius/form/general/Login.jsp");
		 }
		else if(loginform.upassword.value==(""))
		{
		alert ("Enter the password");
		document.loginForm.upassword.focus();
		return false;
     response.sendRedirect("/Genius/form/general/Login.jsp");
		}
		else
		{return true;}
		
	}
	</script>




<body id="login-main">

<%
	Connection con=null;CallableStatement cstmt=null;ResultSet firmresult=null;
	   String firm_id=null,short_name=null,firm_name=null,firm_city=null,firm_image=null;
		
		//background="<%=basePathimages\backgrund-page.gif"
        String original_path=new File("..").getCanonicalPath();
     	String created_path=original_path+"\\Container.war\\";
   		session.setAttribute("created_path",created_path);
   		session.setAttribute("container_path",basePath1);
		//out.println("original_path: "+(original_path));
		//String RealPath=(request.getRealPath("/"));
		//out.println("createdpath: "+(created_path));
		try
		{
	
	con=ConnectionManager.getConnection();
            
           /* cstmt = con.prepareCall("{?=call fun_retrieve_firm_details(?)}");
	cstmt.registerOutParameter(1, Types.OTHER);
	cstmt.setObject(2,firmresult);
	con.setAutoCommit(false);
	cstmt.execute();
	
	firmresult =(ResultSet) cstmt.getObject(1);	
         	*/PreparedStatement prst=con.prepareStatement("select firm_id,name,city,logo_path,short_name from firm_master limit 1 ");     
         	firmresult=prst.executeQuery();
            while(firmresult.next())
            {
            	 firm_id=firmresult.getString(1);
            	 firm_name=firmresult.getString(2);
            	 firm_city=firmresult.getString(3);
            	 firm_image=firmresult.getString(4);
            	 short_name=firmresult.getString(5);
           
            session.setAttribute("firm_id",firm_id);
            session.setAttribute("firm_name",firm_name);
            session.setAttribute("firm_city",firm_city);
            session.setAttribute("firm_image",firm_image);
            session.setAttribute("firm_short",short_name);
                      
           
            }
         }
         catch(Exception e)
         {System.out.print("Exception occured to connect:  "+e);}
%>

  <form name=loginform  method=get action="/Genius/LoginServlet" >
  <div style="padding: 100px 0 0 250px;">
  <div id="login-box">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
  <h2 align="left">&nbsp;<img width="70" height="70" 
    src="<%=(basePath1+firm_image)%>" />&nbsp;&nbsp;&nbsp;&nbsp; Login</h2><%=firm_name %>
   <br/>
<div id="login-box-name" style="margin-top:20px;">Loginid:</div>
<div id="login-box-field" style="margin-top:20px;">
<input name="uname" class="form-login" title="Username" value="" size="30" maxlength="2048" /></div>
<div id="login-box-name">Password:</div><div id="login-box-field">
<input name="upassword" type="password" class="form-login" title="Password" value="" size="30" maxlength="2048" />
</div>
<br />
<br/>
<!-- <span class="login-box-options"><input type="checkbox" name="1" value="1"> Remember Me <a href="#" style="margin-left:30px;">Forgot password?</a></span> -->
<br />
<br />&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 
<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <input type="image" align="middle" alt="login" src="<%=basePath1%>login-btn.png" onclick="valid()"/>&nbsp;
</form>
</div>
</div>
</body>
</html>
